package wox.lonice.utis;

import com.alibaba.fastjson.JSONObject;
import wox.lonice.dto.MaterialSourceData;
import wox.lonice.dto.SourceData;

import java.time.LocalDate;
import java.time.temporal.ChronoUnit;

public class Test1 {

    public static void main(String[] args){

//        new BigDecimal("--");
//        MaterialSourceData materialSourceData = new MaterialSourceData();
//        List<String> stringList = Lists.newArrayList();
//
//        stringList.add("123");
//        materialSourceData.setStringLisr(stringList);
//
//        asdewe(materialSourceData);


        System.out.println(ChronoUnit.DAYS.between(LocalDate.of(2019, 5, 2), LocalDate.now()));



//        Map<Integer, String> map = Maps.newHashMap();
//        map.put(1, "1");
//        map.put(2, "2");
//        System.out.println(JSONObject.toJSONString(map));

//        Constant a = new Constant("max_length", 100);
//        Constant b = new Constant("b", 10);
////        Constant b = new Constant("max_length = 10");
//        Expression e = new Expression("max_length>96", a, b);
//        mXparser.consolePrintln("Res: " + e.getExpressionString() + " = " + e.calculate());
//
//        String str = "parcel_weight>560 || mid_length>17 || min_length>17|| max_length>27";
//
//
//        Constant parcel_weight = new Constant("parcel_weight", 100);
//        Constant mid_length = new Constant("mid_length", 10);
//        Constant min_length = new Constant("min_length", 10);
//        Constant max_length = new Constant("max_length", 10);
//
//        Expression exl = new Expression(str, parcel_weight, mid_length, min_length, max_length);
//        mXparser.consolePrintln(exl.getExpressionString() + " = " + exl.calculate());
//
//        String strs = "1==1 && parcel_weight>1120";
////        String strs = "1==1";
//
////        strs = strs.replace("(\"house\" in address_to_spec_tags)", "1==1").trim();
//
//        Constant house = new Constant("\"house\" in address_to_spec_tags", 1);
//        Constant parcel_weights = new Constant("parcel_weight", 1100);
//        Expression exsz = new Expression(strs, house, parcel_weights);
////        Expression exsz = new Expression(strs, house, parcel_weights, min_length, max_length);
//        mXparser.consolePrintln(exsz.getExpressionString() + " = " + exsz.calculate());
//
//        if(exsz.calculate() == 1){
//            System.out.println("11111");
//        } else if(exsz.calculate() == 0){
//            System.out.println("22222");
//        } else {
//            System.out.println("33333");
//        }

//        System.out.println(ex.calculate());

//        Assert.assertEquals(RegTestExpression.start(), 0);

//        Assert.assertEquals(RegTestExpressionAPI.start(), 0);

//        Assert.assertEquals(RegTestSyntax.start(), 0);


//        Argument days = new Argument("days = 30");
//        Expression min = new Expression("min(days/10,1)", days);
//        mXparser.consolePrint(min.getExpressionString() + "----" + min.calculate());
//        Expression e = new Expression("2-(32-4)/(23+4/5)-(2-4)*(4+6-98.2)+4");
//        mXparser.consolePrintln("Res: " + e.getExpressionString() + " = " + e.calculate());
//        Expression abs = new Expression("abs(-1)");
//        mXparser.consolePrintln("Res: " + abs.getExpressionString() + " = " + abs.calculate());
//        Expression sqrt = new Expression("sqrt(2)");
//        mXparser.consolePrintln("Res: " + sqrt.getExpressionString() + " = " + sqrt.calculate());
//        Function A = new Function("t(a,b) = 1/2 * a *b");
//        Expression expression = new Expression("t(2,4)",A);
//        mXparser.consolePrintln(expression.getExpressionString() +"-----------"+expression.calculate());
//        Argument a = new Argument("a = 3");
//        Argument b = new Argument("b = 3");
//        Argument h = new Argument("h = 4");
//        Expression expression1 = new Expression("t(b,h)",A,b,h,a);
//        mXparser.consolePrintln(expression1.getExpressionString() +"-----------"+expression1.calculate());
//        Expression expression2 = new Expression("1/2 * a *b",A,b,h,a);
//        mXparser.consolePrintln(expression2.getExpressionString() +"-----------"+expression2.calculate());
    }

    private static void asdewe(SourceData sourceData){
        MaterialSourceData materialSourceData = (MaterialSourceData)sourceData;
        System.out.println(JSONObject.toJSONString(materialSourceData.getStringLisr()));
    }
}
